<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/api.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<title>CDetailView</title>
</head>

<body>
<div id="apiPage">

<div id="apiHeader">
<a href="http://www.yiiframework.com">Yii Framework</a> v1.1.17 Class Reference
</div><!-- end of header -->

<div id="content">
<h1>CDetailView</h1>
<div id="nav">
<a href="index.html">All Packages</a>
| <a href="#properties">Properties</a>
| <a href="#methods">Methods</a>
</div>

<table class="summaryTable docClass">
<colgroup>
	<col class="col-name" />
	<col class="col-value" />
</colgroup>
<tr>
  <th>Package</th>
  <td><a href="index.html#zii.widgets">zii.widgets</a></td>
</tr>
<tr>
  <th>Inheritance</th>
  <td>class CDetailView &raquo;
<a href="CWidget.html">CWidget</a> &raquo;
<a href="CBaseController.html">CBaseController</a> &raquo;
<a href="CComponent.html">CComponent</a></td>
</tr>
<tr>
  <th>Since</th>
  <td>1.1</td>
</tr>
<tr>
  <th>Source Code</th>
  <td><a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php">framework/zii/widgets/CDetailView.php</a></td>
</tr>
</table>

<div id="classDescription">
CDetailView displays the detail of a single data model.
<br/><br/>
CDetailView is best used for displaying a model in a regular format (e.g. each model attribute
is displayed as a row in a table.) The model can be either an instance of <a href="CModel.html">CModel</a>
or an associative array.
<br/><br/>
CDetailView uses the <a href="CDetailView.html#attributes">attributes</a> property to determines which model attributes
should be displayed and how they should be formatted.
<br/><br/>
A typical usage of CDetailView is as follows:
<pre>
$this-&gt;widget('zii.widgets.CDetailView', array(
    'data'=&gt;$model,
    'attributes'=&gt;array(
        'title',             // title attribute (in plain text)
        'owner.name',        // an attribute of the related object &quot;owner&quot;
        'description:html',  // description attribute in HTML
        array(               // related city displayed as a link
            'label'=&gt;'City',
            'type'=&gt;'raw',
            'value'=&gt;CHtml::link(CHtml::encode($model-&gt;city-&gt;name),
                                 array('city/view','id'=&gt;$model-&gt;city-&gt;id)),
        ),
    ),
));
</pre></div>
<a name="properties"></a>

<div class="summary docProperty">
<h2>Public Properties</h2>

<p><a href="#" class="toggle">Hide inherited properties</a></p>

<table class="summaryTable">
<colgroup>
	<col class="col-property" />
	<col class="col-type" />
	<col class="col-description" />
	<col class="col-defined" />
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
<tr class="inherited" id="actionPrefix">
  <td><a href="CWidget.html#actionPrefix-detail">actionPrefix</a></td>
  <td>string</td>
  <td>the prefix to the IDs of the <a href="CDetailView.html#actions">actions</a>.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr id="attributes">
  <td><a href="CDetailView.html#attributes-detail">attributes</a></td>
  <td>array</td>
  <td>a list of attributes to be displayed in the detail view.</td>
  <td>CDetailView</td>
</tr>
<tr id="baseScriptUrl">
  <td><a href="CDetailView.html#baseScriptUrl-detail">baseScriptUrl</a></td>
  <td>string</td>
  <td>the base script URL for all detail view resources (e.g. javascript, CSS file, images).</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="controller">
  <td><a href="CWidget.html#controller-detail">controller</a></td>
  <td><a href="CController.html">CController</a></td>
  <td>Returns the controller that this widget belongs to.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr id="cssFile">
  <td><a href="CDetailView.html#cssFile-detail">cssFile</a></td>
  <td>string</td>
  <td>the URL of the CSS file used by this detail view.</td>
  <td>CDetailView</td>
</tr>
<tr id="data">
  <td><a href="CDetailView.html#data-detail">data</a></td>
  <td>mixed</td>
  <td>the data model whose details are to be displayed.</td>
  <td>CDetailView</td>
</tr>
<tr id="formatter">
  <td><a href="CDetailView.html#formatter-detail">formatter</a></td>
  <td><a href="CFormatter.html">CFormatter</a></td>
  <td>the formatter instance.</td>
  <td>CDetailView</td>
</tr>
<tr id="htmlOptions">
  <td><a href="CDetailView.html#htmlOptions-detail">htmlOptions</a></td>
  <td>array</td>
  <td>the HTML options used for <a href="CDetailView.html#tagName">tagName</a></td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="id">
  <td><a href="CWidget.html#id-detail">id</a></td>
  <td>string</td>
  <td>Returns the ID of the widget or generates a new one if requested.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr id="itemCssClass">
  <td><a href="CDetailView.html#itemCssClass-detail">itemCssClass</a></td>
  <td>array</td>
  <td>the CSS class names for the items displaying attribute values.</td>
  <td>CDetailView</td>
</tr>
<tr id="itemTemplate">
  <td><a href="CDetailView.html#itemTemplate-detail">itemTemplate</a></td>
  <td>string</td>
  <td>the template used to render a single attribute.</td>
  <td>CDetailView</td>
</tr>
<tr id="nullDisplay">
  <td><a href="CDetailView.html#nullDisplay-detail">nullDisplay</a></td>
  <td>string</td>
  <td>the text to be displayed when an attribute value is null.</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="owner">
  <td><a href="CWidget.html#owner-detail">owner</a></td>
  <td><a href="CBaseController.html">CBaseController</a></td>
  <td>Returns the owner/creator of this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="skin">
  <td><a href="CWidget.html#skin-detail">skin</a></td>
  <td>mixed</td>
  <td>the name of the skin to be used by this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr id="tagName">
  <td><a href="CDetailView.html#tagName-detail">tagName</a></td>
  <td>string</td>
  <td>the name of the tag for rendering the detail view.</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="viewPath">
  <td><a href="CWidget.html#viewPath-detail">viewPath</a></td>
  <td>string</td>
  <td>Returns the directory containing the view files for this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
</table>
</div>
<a name="methods"></a>

<div class="summary docMethod">
<h2>Public Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summaryTable">
<colgroup>
	<col class="col-method" />
	<col class="col-description" />
	<col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
<tr class="inherited" id="__call">
  <td><a href="CComponent.html#__call-detail">__call()</a></td>
  <td>Calls the named method which is not a class method.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="__construct">
  <td><a href="CWidget.html#__construct-detail">__construct()</a></td>
  <td>Constructor.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="__get">
  <td><a href="CComponent.html#__get-detail">__get()</a></td>
  <td>Returns a property value, an event handler list or a behavior based on its name.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="__isset">
  <td><a href="CComponent.html#__isset-detail">__isset()</a></td>
  <td>Checks if a property value is null.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="__set">
  <td><a href="CComponent.html#__set-detail">__set()</a></td>
  <td>Sets value of a component property.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="__unset">
  <td><a href="CComponent.html#__unset-detail">__unset()</a></td>
  <td>Sets a component property to be null.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="actions">
  <td><a href="CWidget.html#actions-detail">actions()</a></td>
  <td>Returns a list of actions that are used by this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="asa">
  <td><a href="CComponent.html#asa-detail">asa()</a></td>
  <td>Returns the named behavior object.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="attachBehavior">
  <td><a href="CComponent.html#attachBehavior-detail">attachBehavior()</a></td>
  <td>Attaches a behavior to this component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="attachBehaviors">
  <td><a href="CComponent.html#attachBehaviors-detail">attachBehaviors()</a></td>
  <td>Attaches a list of behaviors to the component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="attachEventHandler">
  <td><a href="CComponent.html#attachEventHandler-detail">attachEventHandler()</a></td>
  <td>Attaches an event handler to an event.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="beginCache">
  <td><a href="CBaseController.html#beginCache-detail">beginCache()</a></td>
  <td>Begins fragment caching.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="beginClip">
  <td><a href="CBaseController.html#beginClip-detail">beginClip()</a></td>
  <td>Begins recording a clip.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="beginContent">
  <td><a href="CBaseController.html#beginContent-detail">beginContent()</a></td>
  <td>Begins the rendering of content that is to be decorated by the specified view.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="beginWidget">
  <td><a href="CBaseController.html#beginWidget-detail">beginWidget()</a></td>
  <td>Creates a widget and executes it.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="canGetProperty">
  <td><a href="CComponent.html#canGetProperty-detail">canGetProperty()</a></td>
  <td>Determines whether a property can be read.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="canSetProperty">
  <td><a href="CComponent.html#canSetProperty-detail">canSetProperty()</a></td>
  <td>Determines whether a property can be set.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="createWidget">
  <td><a href="CBaseController.html#createWidget-detail">createWidget()</a></td>
  <td>Creates a widget and initializes it.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="detachBehavior">
  <td><a href="CComponent.html#detachBehavior-detail">detachBehavior()</a></td>
  <td>Detaches a behavior from the component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="detachBehaviors">
  <td><a href="CComponent.html#detachBehaviors-detail">detachBehaviors()</a></td>
  <td>Detaches all behaviors from the component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="detachEventHandler">
  <td><a href="CComponent.html#detachEventHandler-detail">detachEventHandler()</a></td>
  <td>Detaches an existing event handler.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="disableBehavior">
  <td><a href="CComponent.html#disableBehavior-detail">disableBehavior()</a></td>
  <td>Disables an attached behavior.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="disableBehaviors">
  <td><a href="CComponent.html#disableBehaviors-detail">disableBehaviors()</a></td>
  <td>Disables all behaviors attached to this component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="enableBehavior">
  <td><a href="CComponent.html#enableBehavior-detail">enableBehavior()</a></td>
  <td>Enables an attached behavior.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="enableBehaviors">
  <td><a href="CComponent.html#enableBehaviors-detail">enableBehaviors()</a></td>
  <td>Enables all behaviors attached to this component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="endCache">
  <td><a href="CBaseController.html#endCache-detail">endCache()</a></td>
  <td>Ends fragment caching.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="endClip">
  <td><a href="CBaseController.html#endClip-detail">endClip()</a></td>
  <td>Ends recording a clip.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="endContent">
  <td><a href="CBaseController.html#endContent-detail">endContent()</a></td>
  <td>Ends the rendering of content.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="endWidget">
  <td><a href="CBaseController.html#endWidget-detail">endWidget()</a></td>
  <td>Ends the execution of the named widget.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="evaluateExpression">
  <td><a href="CComponent.html#evaluateExpression-detail">evaluateExpression()</a></td>
  <td>Evaluates a PHP expression or callback under the context of this component.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="getController">
  <td><a href="CWidget.html#getController-detail">getController()</a></td>
  <td>Returns the controller that this widget belongs to.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="getEventHandlers">
  <td><a href="CComponent.html#getEventHandlers-detail">getEventHandlers()</a></td>
  <td>Returns the list of attached event handlers for an event.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr id="getFormatter">
  <td><a href="CDetailView.html#getFormatter-detail">getFormatter()</a></td>
  <td>Returns the formatter instance. Defaults to the 'format' application component.</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="getId">
  <td><a href="CWidget.html#getId-detail">getId()</a></td>
  <td>Returns the ID of the widget or generates a new one if requested.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="getOwner">
  <td><a href="CWidget.html#getOwner-detail">getOwner()</a></td>
  <td>Returns the owner/creator of this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="getViewFile">
  <td><a href="CWidget.html#getViewFile-detail">getViewFile()</a></td>
  <td>Looks for the view script file according to the view name.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="getViewPath">
  <td><a href="CWidget.html#getViewPath-detail">getViewPath()</a></td>
  <td>Returns the directory containing the view files for this widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="hasEvent">
  <td><a href="CComponent.html#hasEvent-detail">hasEvent()</a></td>
  <td>Determines whether an event is defined.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="hasEventHandler">
  <td><a href="CComponent.html#hasEventHandler-detail">hasEventHandler()</a></td>
  <td>Checks whether the named event has attached handlers.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="hasProperty">
  <td><a href="CComponent.html#hasProperty-detail">hasProperty()</a></td>
  <td>Determines whether a property is defined.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr id="init">
  <td><a href="CDetailView.html#init-detail">init()</a></td>
  <td>Initializes the detail view.</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="raiseEvent">
  <td><a href="CComponent.html#raiseEvent-detail">raiseEvent()</a></td>
  <td>Raises an event.</td>
  <td><a href="CComponent.html">CComponent</a></td>
</tr>
<tr class="inherited" id="render">
  <td><a href="CWidget.html#render-detail">render()</a></td>
  <td>Renders a view.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="renderFile">
  <td><a href="CBaseController.html#renderFile-detail">renderFile()</a></td>
  <td>Renders a view file.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr class="inherited" id="renderInternal">
  <td><a href="CBaseController.html#renderInternal-detail">renderInternal()</a></td>
  <td>Renders a view file.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
<tr id="run">
  <td><a href="CDetailView.html#run-detail">run()</a></td>
  <td>Renders the detail view.</td>
  <td>CDetailView</td>
</tr>
<tr id="setFormatter">
  <td><a href="CDetailView.html#setFormatter-detail">setFormatter()</a></td>
  <td>Sets the formatter instance</td>
  <td>CDetailView</td>
</tr>
<tr class="inherited" id="setId">
  <td><a href="CWidget.html#setId-detail">setId()</a></td>
  <td>Sets the ID of the widget.</td>
  <td><a href="CWidget.html">CWidget</a></td>
</tr>
<tr class="inherited" id="widget">
  <td><a href="CBaseController.html#widget-detail">widget()</a></td>
  <td>Creates a widget and executes it.</td>
  <td><a href="CBaseController.html">CBaseController</a></td>
</tr>
</table>
</div>
<div class="summary docMethod">
<h2>Protected Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summaryTable">
<colgroup>
	<col class="col-method" />
	<col class="col-description" />
	<col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
<tr id="renderItem">
  <td><a href="CDetailView.html#renderItem-detail">renderItem()</a></td>
  <td>This method is used by run() to render item row</td>
  <td>CDetailView</td>
</tr>
</table>
</div>
<a name="events"></a>

<h2>Property Details</h2>
<div class="detailHeader" id="attributes-detail">
attributes<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public array <b>$attributes</b>;</div>

<p>a list of attributes to be displayed in the detail view. Each array element
represents the specification for displaying one particular attribute.
<br/><br/>
An attribute can be specified as a string in the format of "Name:Type:Label".
Both "Type" and "Label" are optional.
<br/><br/>
"Name" refers to the attribute name. It can be either a property (e.g. "title") or a sub-property (e.g. "owner.username").
<br/><br/>
"Label" represents the label for the attribute display. If it is not given, "Name" will be used to generate the appropriate label.
<br/><br/>
"Type" represents the type of the attribute. It determines how the attribute value should be formatted and displayed.
It is defaulted to be 'text'.
"Type" should be recognizable by the <a href="CDetailView.html#formatter">formatter</a>. In particular, if "Type" is "xyz", then the "formatXyz" method
of <a href="CDetailView.html#formatter">formatter</a> will be invoked to format the attribute value for display. By default when <a href="CFormatter.html">CFormatter</a> is used,
these "Type" values are valid: raw, text, ntext, html, date, time, datetime, boolean, number, email, image, url.
For more details about these types, please refer to <a href="CFormatter.html">CFormatter</a>.
<br/><br/>
An attribute can also be specified in terms of an array with the following elements:
<ul>
<li>label: the label associated with the attribute. If this is not specified, the following "name" element
will be used to generate an appropriate label.</li>
<li>name: the name of the attribute. This can be either a property or a sub-property of the model.
If the below "value" element is specified, this will be ignored.</li>
<li>value: the value to be displayed. If this is not specified, the above "name" element will be used
to retrieve the corresponding attribute value for display. Note that this value will be formatted according
to the "type" option as described below. This can also be an anonymous function whose return value will be
used as a value. The signature of the function should be <code>function($data)</code> where data refers to
the <a href="CDetailView.html#data">data</a> property of the detail view widget.</li>
<li>type: the type of the attribute that determines how the attribute value would be formatted.
Please see above for possible values.
<li>cssClass: the CSS class to be used for this item. This option is available since version 1.1.3.</li>
<li>template: the template used to render the attribute. If this is not specified, <a href="CDetailView.html#itemTemplate">itemTemplate</a>
will be used instead. For more details on how to set this option, please refer to <a href="CDetailView.html#itemTemplate">itemTemplate</a>.
This option is available since version 1.1.1.</li>
<li>visible: whether the attribute is visible. If set to <code>false</code>, the table row for the attribute will not be rendered.
This option is available since version 1.1.5.</li>
</ul></p>


<div class="detailHeader" id="baseScriptUrl-detail">
baseScriptUrl<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public string <b>$baseScriptUrl</b>;</div>

<p>the base script URL for all detail view resources (e.g. javascript, CSS file, images).
Defaults to null, meaning using the integrated detail view resources (which are published as assets).</p>


<div class="detailHeader" id="cssFile-detail">
cssFile<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public string <b>$cssFile</b>;</div>

<p>the URL of the CSS file used by this detail view. Defaults to null, meaning using the integrated
CSS file. If this is set false, you are responsible to explicitly include the necessary CSS file in your page.</p>


<div class="detailHeader" id="data-detail">
data<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public mixed <b>$data</b>;</div>

<p>the data model whose details are to be displayed. This can be either a <a href="CModel.html">CModel</a> instance
(e.g. a <a href="CActiveRecord.html">CActiveRecord</a> object or a <a href="CFormModel.html">CFormModel</a> object) or an associative array.</p>


<div class="detailHeader" id="formatter-detail">
formatter<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public <a href="CFormatter.html">CFormatter</a> <a href="CDetailView.html#getFormatter"><b>getFormatter</b></a>()<br/>public void <a href="CDetailView.html#setFormatter"><b>setFormatter</b></a>(<a href="CFormatter.html">CFormatter</a> $value)</div>

<p>the formatter instance. Defaults to the 'format' application component.</p>


<div class="detailHeader" id="htmlOptions-detail">
htmlOptions<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public array <b>$htmlOptions</b>;</div>

<p>the HTML options used for <a href="CDetailView.html#tagName">tagName</a></p>


<div class="detailHeader" id="itemCssClass-detail">
itemCssClass<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public array <b>$itemCssClass</b>;</div>

<p>the CSS class names for the items displaying attribute values. If multiple CSS class names are given,
they will be assigned to the items sequentially and repeatedly.
Defaults to <code>array('odd', 'even')</code>.</p>


<div class="detailHeader" id="itemTemplate-detail">
itemTemplate<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public string <b>$itemTemplate</b>;</div>

<p>the template used to render a single attribute. Defaults to a table row.
These tokens are recognized: "{class}", "{label}" and "{value}". They will be replaced
with the CSS class name for the item, the label and the attribute value, respectively.</p>

<div class="SeeAlso">
<h4>See Also</h4>
<ul>
	<li><a href="CDetailView.html#itemCssClass">itemCssClass</a></li>
</ul>
</div>

<div class="detailHeader" id="nullDisplay-detail">
nullDisplay<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public string <b>$nullDisplay</b>;</div>

<p>the text to be displayed when an attribute value is null. Defaults to "Not set".</p>


<div class="detailHeader" id="tagName-detail">
tagName<span class="detailHeaderTag">
property
</span>
</div>

<div class="signature">
public string <b>$tagName</b>;</div>

<p>the name of the tag for rendering the detail view. Defaults to 'table'.
If set to null, no tag will be rendered.</p>

<div class="SeeAlso">
<h4>See Also</h4>
<ul>
	<li><a href="CDetailView.html#itemTemplate">itemTemplate</a></li>
</ul>
</div>

<h2>Method Details</h2>

<div class="detailHeader" id="getFormatter-detail">
getFormatter()
<span class="detailHeaderTag">
method
</span>
</div>

<table class="summaryTable">
<tr><td colspan="3">
<div class="signature2">
public <a href="CFormatter.html">CFormatter</a> <b>getFormatter</b>()</div>
</td></tr>
<tr>
  <td class="paramNameCol">{return}</td>
  <td class="paramTypeCol"><a href="CFormatter.html">CFormatter</a></td>
  <td class="paramDescCol">the formatter instance. Defaults to the 'format' application component.</td>
</tr>
</table>

<div class="sourceCode">
<b>Source Code:</b> <a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php#L246">framework/zii/widgets/CDetailView.php#246</a> (<b><a href="#" class="show">show</a></b>)
<div class="code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">getFormatter</span><span style="color: #007700">()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">_formatter</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">_formatter</span><span style="color: #007700">=</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">app</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">_formatter</span><span style="color: #007700">;<br />}</span>
</span>
</code></div>
</div>
<p></p>


<div class="detailHeader" id="init-detail">
init()
<span class="detailHeaderTag">
method
</span>
</div>

<table class="summaryTable">
<tr><td colspan="3">
<div class="signature2">
public void <b>init</b>()</div>
</td></tr>
</table>

<div class="sourceCode">
<b>Source Code:</b> <a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php#L136">framework/zii/widgets/CDetailView.php#136</a> (<b><a href="#" class="show">show</a></b>)
<div class="code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">init</span><span style="color: #007700">()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">CException</span><span style="color: #007700">(</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'zii'</span><span style="color: #007700">,</span><span style="color: #DD0000">'Please&nbsp;specify&nbsp;the&nbsp;"data"&nbsp;property.'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attributes</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data&nbsp;</span><span style="color: #007700">instanceof&nbsp;</span><span style="color: #0000BB">CModel</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attributes</span><span style="color: #007700">=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attributeNames</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attributes</span><span style="color: #007700">=</span><span style="color: #0000BB">array_keys</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">CException</span><span style="color: #007700">(</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'zii'</span><span style="color: #007700">,</span><span style="color: #DD0000">'Please&nbsp;specify&nbsp;the&nbsp;"attributes"&nbsp;property.'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nullDisplay</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nullDisplay</span><span style="color: #007700">=</span><span style="color: #DD0000">'&lt;span&nbsp;class="null"&gt;'</span><span style="color: #007700">.</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'zii'</span><span style="color: #007700">,</span><span style="color: #DD0000">'Not&nbsp;set'</span><span style="color: #007700">).</span><span style="color: #DD0000">'&lt;/span&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">htmlOptions</span><span style="color: #007700">[</span><span style="color: #DD0000">'id'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">id</span><span style="color: #007700">=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">htmlOptions</span><span style="color: #007700">[</span><span style="color: #DD0000">'id'</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">htmlOptions</span><span style="color: #007700">[</span><span style="color: #DD0000">'id'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">id</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">baseScriptUrl</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">baseScriptUrl</span><span style="color: #007700">=</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">app</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">getAssetManager</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">publish</span><span style="color: #007700">(</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">getPathOfAlias</span><span style="color: #007700">(</span><span style="color: #DD0000">'zii.widgets.assets'</span><span style="color: #007700">)).</span><span style="color: #DD0000">'/detailview'</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cssFile</span><span style="color: #007700">!==</span><span style="color: #0000BB">false</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cssFile</span><span style="color: #007700">===</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cssFile</span><span style="color: #007700">=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">baseScriptUrl</span><span style="color: #007700">.</span><span style="color: #DD0000">'/styles.css'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">app</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">getClientScript</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">registerCssFile</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cssFile</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</span>
</span>
</code></div>
</div>
<p>Initializes the detail view.
This method will initialize required property values.</p>


<div class="detailHeader" id="renderItem-detail">
renderItem()
<span class="detailHeaderTag">
method
(available since v1.1.11)
</span>
</div>

<table class="summaryTable">
<tr><td colspan="3">
<div class="signature2">
protected void <b>renderItem</b>(array $options, string $templateData)</div>
</td></tr>
<tr>
  <td class="paramNameCol">$options</td>
  <td class="paramTypeCol">array</td>
  <td class="paramDescCol">config options for this item/attribute from <a href="CDetailView.html#attributes">attributes</a></td>
</tr>
<tr>
  <td class="paramNameCol">$templateData</td>
  <td class="paramTypeCol">string</td>
  <td class="paramDescCol">data that will be inserted into <a href="CDetailView.html#itemTemplate">itemTemplate</a></td>
</tr>
</table>

<div class="sourceCode">
<b>Source Code:</b> <a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php#L238">framework/zii/widgets/CDetailView.php#238</a> (<b><a href="#" class="show">show</a></b>)
<div class="code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">protected&nbsp;function&nbsp;</span><span style="color: #0000BB">renderItem</span><span style="color: #007700">(</span><span style="color: #0000BB">$options</span><span style="color: #007700">,</span><span style="color: #0000BB">$templateData</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">strtr</span><span style="color: #007700">(isset(</span><span style="color: #0000BB">$options</span><span style="color: #007700">[</span><span style="color: #DD0000">'template'</span><span style="color: #007700">])&nbsp;?&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">[</span><span style="color: #DD0000">'template'</span><span style="color: #007700">]&nbsp;:&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">itemTemplate</span><span style="color: #007700">,</span><span style="color: #0000BB">$templateData</span><span style="color: #007700">);<br />}</span>
</span>
</code></div>
</div>
<p>This method is used by run() to render item row</p>


<div class="detailHeader" id="run-detail">
run()
<span class="detailHeaderTag">
method
</span>
</div>

<table class="summaryTable">
<tr><td colspan="3">
<div class="signature2">
public void <b>run</b>()</div>
</td></tr>
</table>

<div class="sourceCode">
<b>Source Code:</b> <a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php#L171">framework/zii/widgets/CDetailView.php#171</a> (<b><a href="#" class="show">show</a></b>)
<div class="code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">run</span><span style="color: #007700">()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$formatter</span><span style="color: #007700">=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getFormatter</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">tagName</span><span style="color: #007700">!==</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">CHtml</span><span style="color: #007700">::</span><span style="color: #0000BB">openTag</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">tagName</span><span style="color: #007700">,</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">htmlOptions</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$n</span><span style="color: #007700">=</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">itemCssClass</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">itemCssClass</span><span style="color: #007700">)&nbsp;:&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;foreach(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attributes&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">is_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!</span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/^([\w\.]+)(:(\w*))?(:(.*))?$/'</span><span style="color: #007700">,</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">,</span><span style="color: #0000BB">$matches</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">CException</span><span style="color: #007700">(</span><span style="color: #0000BB">Yii</span><span style="color: #007700">::</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'zii'</span><span style="color: #007700">,</span><span style="color: #DD0000">'The&nbsp;attribute&nbsp;must&nbsp;be&nbsp;specified&nbsp;in&nbsp;the&nbsp;format&nbsp;of&nbsp;"Name:Type:Label",&nbsp;where&nbsp;"Type"&nbsp;and&nbsp;"Label"&nbsp;are&nbsp;optional.'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">=array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'name'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'type'</span><span style="color: #007700">=&gt;isset(</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;?&nbsp;</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">]&nbsp;:&nbsp;</span><span style="color: #DD0000">'text'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">5</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'label'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">5</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'visible'</span><span style="color: #007700">])&nbsp;&amp;&amp;&nbsp;!</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'visible'</span><span style="color: #007700">])<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">=array(</span><span style="color: #DD0000">'{label}'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">''</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'{class}'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$n&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">itemCssClass</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">%</span><span style="color: #0000BB">$n</span><span style="color: #007700">]&nbsp;:&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'cssClass'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{class}'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'cssClass'</span><span style="color: #007700">].</span><span style="color: #DD0000">'&nbsp;'</span><span style="color: #007700">.(</span><span style="color: #0000BB">$n&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{class}'</span><span style="color: #007700">]&nbsp;:&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'label'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{label}'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'label'</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data&nbsp;</span><span style="color: #007700">instanceof&nbsp;</span><span style="color: #0000BB">CModel</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{label}'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getAttributeLabel</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">]);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{label}'</span><span style="color: #007700">]=</span><span style="color: #0000BB">ucwords</span><span style="color: #007700">(</span><span style="color: #0000BB">trim</span><span style="color: #007700">(</span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'-'</span><span style="color: #007700">,</span><span style="color: #DD0000">'_'</span><span style="color: #007700">,</span><span style="color: #DD0000">'.'</span><span style="color: #007700">),</span><span style="color: #DD0000">'&nbsp;'</span><span style="color: #007700">,</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'/(?&lt;![A-Z])[A-Z]/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&nbsp;\0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">])))));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]=</span><span style="color: #DD0000">'text'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">=</span><span style="color: #0000BB">is_object</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">])&nbsp;&amp;&amp;&nbsp;</span><span style="color: #0000BB">get_class</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">])&nbsp;===&nbsp;</span><span style="color: #DD0000">'Closure'&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">call_user_func</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">],</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">)&nbsp;:&nbsp;</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(isset(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">]))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">=</span><span style="color: #0000BB">CHtml</span><span style="color: #007700">::</span><span style="color: #0000BB">value</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">,</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">]);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$value</span><span style="color: #007700">=</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">[</span><span style="color: #DD0000">'{value}'</span><span style="color: #007700">]=</span><span style="color: #0000BB">$value</span><span style="color: #007700">===</span><span style="color: #0000BB">null&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nullDisplay&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">$formatter</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">,</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">renderItem</span><span style="color: #007700">(</span><span style="color: #0000BB">$attribute</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$tr</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">tagName</span><span style="color: #007700">!==</span><span style="color: #0000BB">null</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">CHtml</span><span style="color: #007700">::</span><span style="color: #0000BB">closeTag</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">tagName</span><span style="color: #007700">);<br />}</span>
</span>
</code></div>
</div>
<p>Renders the detail view.
This is the main entry of the whole detail view rendering.</p>


<div class="detailHeader" id="setFormatter-detail">
setFormatter()
<span class="detailHeaderTag">
method
</span>
</div>

<table class="summaryTable">
<tr><td colspan="3">
<div class="signature2">
public void <b>setFormatter</b>(<a href="CFormatter.html">CFormatter</a> $value)</div>
</td></tr>
<tr>
  <td class="paramNameCol">$value</td>
  <td class="paramTypeCol"><a href="CFormatter.html">CFormatter</a></td>
  <td class="paramDescCol">the formatter instance</td>
</tr>
</table>

<div class="sourceCode">
<b>Source Code:</b> <a class="sourceLink" href="https://github.com/yiisoft/yii/blob/1.1.17/framework/zii/widgets/CDetailView.php#L256">framework/zii/widgets/CDetailView.php#256</a> (<b><a href="#" class="show">show</a></b>)
<div class="code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">setFormatter</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">_formatter</span><span style="color: #007700">=</span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />}</span>
</span>
</code></div>
</div>
<p></p>


</div><!-- end of content -->

<div id="apiFooter">
&copy; 2008-2013 by <a href="http://www.yiisoft.com">Yii Software LLC</a><br/>
All Rights Reserved.<br/>
</div><!-- end of footer -->

<script type="text/javascript">
/*<![CDATA[*/
$("a.toggle").toggle(function(){
	$(this).text($(this).text().replace(/Hide/,'Show'));
	$(this).parents(".summary").find(".inherited").hide();
},function(){
	$(this).text($(this).text().replace(/Show/,'Hide'));
	$(this).parents(".summary").find(".inherited").show();
});
$(".sourceCode a.show").toggle(function(){
	$(this).text($(this).text().replace(/show/,'hide'));
	$(this).parents(".sourceCode").find("div.code").show();
},function(){
	$(this).text($(this).text().replace(/hide/,'show'));
	$(this).parents(".sourceCode").find("div.code").hide();
});
$("a.sourceLink").click(function(){
	$(this).attr('target','_blank');
});
/*]]>*/
</script>

</div><!-- end of page -->
</body>
</html>